<?php

namespace app\common\model\gift;

use app\common\model\User;
use think\Model;


class BuyGiftLog extends Model
{

    

    

    // 表名
    protected $name = 'buy_gift_log';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'user',
        'my_user',
    ];


    protected function getUserAttr($value, $data)
    {
        return User::where('id', $data['to_user_id'])->value('nickname');
    }

    protected function getMyUserAttr($value, $data)
    {
        return User::where('id', $data['user_id'])->value('nickname');
    }






}
